package com.desginer.struct.adapter;

public class PaymentAdapter implements PaymentProcessor{

    private OldPayment oldPayment;

    public PaymentAdapter(OldPayment oldPayment) {
        this.oldPayment = oldPayment;
    }

    @Override
    public void processPayment(String amount) {

        //
        amount = parseAmount(amount);

        this.oldPayment.pay(amount);
    }

    /**
     * 解析金额
     * @param amount
     * @return
     */
    private String parseAmount(String amount){
        System.out.println("解析金额");

        return amount.split(" ")[1];
    }
}
